package com.jzo2o.customer.controller.agency;


import com.jzo2o.common.constants.UserType;
import com.jzo2o.customer.model.dto.request.BankAccountUpsertReqDTO;
import com.jzo2o.customer.model.dto.response.BankAccountResDTO;
import com.jzo2o.customer.service.IAccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 银行账户表 前端控制器
 * </p>
 *
 * @author author
 * @since 2024-12-02
 */
@RestController
@RequestMapping("/agency/bank-account")
@Api(tags = "机构端账户设置")
public class AccountController {


    @Autowired
    private IAccountService accountService;


    @PostMapping
    @ApiOperation("新增账户")
    public void addOrUpdateBankAccount(@RequestBody BankAccountUpsertReqDTO dto){
        accountService.addOrUpdateBankAccount(dto, UserType.INSTITUTION);
    }


    @GetMapping("/currentUserBankAccount")
    @ApiOperation("获取当前用户银行账号")
    public BankAccountResDTO getByIdAccount(Long id){
        return accountService.getByIdAccount(id);
    }
}
